<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body></body>
</html>
<script>
    // 统计abc出现的次数
    const regx = /abcd?/gi;
    let counts = 0;
    let str = `abce|abcd|abcdd|abcdddd`;
    while ((res = regx.exec(str))) {
        counts++;
    }
    console.log(counts);
</script>
